/******************************************************************************
 * This file is part of project ORCA. More information on the project
 * can be found at the following repositories at GitHub's website.
 *
 * http://https://github.com/andersondomingues/orca-sim
 * http://https://github.com/andersondomingues/orca-software
 * http://https://github.com/andersondomingues/orca-mpsoc
 * http://https://github.com/andersondomingues/orca-tools
 *
 * Copyright (C) 2018-2020 Anderson Domingues, <ti.andersondomingues@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
******************************************************************************/
#include "Event.hpp"

using orcasim::base::Event;

/**
 * Operator overload for '<'. Use by the internal queue for sorting events
 * by time.
 * @param e Event to be compared with the instance
 * @return true if the instance happens later in time than event <e>.
 */
bool Event::operator<(const Event& e) const {
    return (this->time > e.time);
}

/**
 * Default constructor. 
 * @param t point in time to execute the event
 * @param p a pointer to the associated hardware module
 */
Event::Event(SimulationTime t, TimedModel* p) {
    this->time = t;
    this->timedModel = p;
}

/**
 * Alternative constructor, required for creating arrays of Event elements. Do 
 * not use this constructor.
 */
Event::Event() {
    // Fields are left unintialized intentionally.
}
